<?php
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { 	die('You are not allowed to call this page directly (wvdb).'); }

// sometimes a error feedback is better than a white screen
@ini_set('error_reporting', E_ALL ^ E_NOTICE);

if ( !class_exists('wvdb') ) :
/**
 * Web Vampire Database Class
 * 
 * @author Long Nguyen Hai
 * @copyright 2011
 * @since 1.0
 */
class wvdb {
    
    
    /**
     * The array for the pagination
     *
     * @since 1.0
     * @access public
     * @var array
     */
    var $paged = false;

	var $default_order = 99999;
    
    /**
     * PHP4 compatibility layer for calling the PHP5 constructor.
     * 
     */
    function wvdb() {
        return $this->__construct();
    }

    /**
     * Init the Database Abstraction layer 
     * 
     */ 
    function __construct() {
        global $wpdb;
        
        $this->paged     = array();
    }
    
    /**
     * PHP5 style destructor and will run when database object is destroyed.
     *
     * @return bool Always true
     */
    function __destruct() {
        return true;
    }   


}
endif;

if ( ! isset($GLOBALS['wvdb']) ) {
    /**
     * Initate the Web Vampire Database Object, for later cache reasons
     * @global object $wvdb Creates a new wvdb object
     * @since 1.0
     */
    unset($GLOBALS['wvdb']);
    $GLOBALS['wvdb'] = new wvdb() ;
}
?>